﻿using System;

namespace SpiderMonkey
{
    [Flags]
    public enum Option : uint
    {
        None = 0,
        /// <summary>
        /// Warn on dubious practice.
        /// </summary>
        Strict = 1,
        /// <summary>
        /// Convert warnings to errors.
        /// </summary>
        WarnError = 2,
        /// <summary>
        /// Make JS_EvaluateScript() use the last object on its obj param's scope chain (that is, the global object) as the ECMA "variables object".
        /// This flag is recommended.  Without it, the two scripts "x = 1" and "var x = 1", where no variable x is in scope, do two different things.  The former creates a property on the global object.  The latter creates a property on obj.  With this flag, both create a global property.
        /// </summary>
        VarObjFix = 4,
        /// <summary>
        /// Caller of JS_CompileScript et al promises to execute the compiled script once only, in the same scope object used for compilation.  The caller may not modify objects on the scope chain between compilation and execution.  This enables compile-time scope chain resolution of consts (a performance optimization).
        /// </summary>
        CompileNGo = 16,
        /// <summary>
        /// @line number ["filename"] option supported for the XUL preprocessor and kindred beasts.
        /// </summary>
        AtLine = 32,
        /// <summary>
        /// ECMAScript for XML (E4X) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in HTML script tags.
        /// </summary>
        XML = 64,
        /// <summary>
        /// When returning from the outermost API call, prevent uncaught exceptions from being converted to error reports.
        /// </summary>
        DontReportUncaught = 256,
        /// <summary>
        /// Throw an exception if a regular expression backtracks more than n3 times, where n is the length of the input string.
        /// </summary>
        Relimit = 512,
        /// <summary>
        /// Disallow function () {} in statement context, per ECMA-262 Edition 3.
        /// </summary>
        AnonFunFix = 1024,
        /// <summary>
        /// Enables the JIT compilation of code in the context. Note that you may currently (Jan 2009) experience bugs with this option enabled.
        /// </summary>
        Jit = 2048,
        /// <summary>
        /// By setting this option, the application promises to the compiler that a null rval out-param will be passed to each call to JS_ExecuteScript.
        /// </summary>
        NoScriptRval = 4096,
        /// <summary>
        /// Instructs the garbage collector not to consider the context's global object a root. The application must ensure that the global object survives as long as the JSContext.
        /// </summary>
        UnrootedGlobal = 8192,
        /// <summary>
        /// Whole-method JIT.
        /// </summary>
        MethodJit = 16384,
        /// <summary>
        /// Profiler to make tracer/methodjit choices.
        /// </summary>
        Profiling = 32768,
        /// <summary>
        /// Always whole-method JIT, don't tune at run-time.
        /// </summary>
        MethodJitAlways = 65536,
    }
}
